package com.itheima.springbootwebtlias.mapper;

import com.github.pagehelper.Page;
import com.itheima.springbootwebtlias.pojo.ClaQueryParam;
import com.itheima.springbootwebtlias.pojo.StuQueryParam;
import com.itheima.springbootwebtlias.pojo.Student;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {

    //4.1 学员列表查询,条件分页查询接口
    List<Student> selectByCondition(StuQueryParam stuQueryParam);

    //4.3 添加学员,新增学生信息接口
    @Insert("insert into student (id, name, no,gender,phone,id_card,is_college,address ,degree,graduation_date,clazz_id, create_time, update_time) " +
            "values (null,#{name},#{no},#{gender},#{phone},#{idCard},#{isCollege},#{address},#{degree},#{graduationDate},#{clazzId},#{createTime},#{updateTime})")
    void saveStudent(Student student);

    //4.4 根据ID查询学生 + 查询回显
    @Select("select * from student where id = #{id}")
    Student queryById(Integer id);

    //4.5 修改学生信息接口
    void update(Student student);

    //4.2 删除学生信息接口 + 批量删除
    void removeBatchById(List<Integer> ids);

    //4.6 违纪处理,违纪次数和违纪扣分
    void violation(Integer id, Short score);

    //5.4 班级人数统计(柱状图)
    List<Map> studentsCount();

    //5.3 学员学历统计(饼图)
    List<Map> studenDegreeCount();
}
